<template>
  <el-table
    ref="table" class="table-state" :data="tableData"
    :header-cell-style="{'text-align':'center', 'font-weight':'700', 'font-size':'medium'}"
    :cell-style="{'text-align':'center', 'font-size':'medium'}">
    <el-table-column prop="shebei" label="设备"></el-table-column>
    <el-table-column prop="hanjidianya" label="电流"></el-table-column>
    <el-table-column prop="hanjidianliu" label="切割速度"></el-table-column>
    <el-table-column prop="songsisudu" label="振动"></el-table-column>
    <el-table-column prop="residianliu" label="电机转速"></el-table-column>
  </el-table>
</template>

<script>
export default {
  name: 'QieMonitorTable',
  data () {
    return {
      welding: [],
      t0: '',
      tableData: [{
        shebei: '切割机一',
        hanjidianya: '',
        hanjidianliu: '',
        songsisudu: '',
        residianliu: ''
      },
      {
        shebei: '切割机二',
        hanjidianya: '',
        hanjidianliu: '',
        songsisudu: '',
        residianliu: ''
      },
      {
        shebei: '切割机三',
        hanjidianya: '',
        hanjidianliu: '',
        songsisudu: '',
        residianliu: ''
      },
      {
        shebei: '切割机四',
        hanjidianya: '',
        hanjidianliu: '',
        songsisudu: '',
        residianliu: ''
      },
      {
        shebei: '切割机五',
        hanjidianya: '',
        hanjidianliu: '',
        songsisudu: '',
        residianliu: ''
      }]
    }
  },
  methods: {
    refreshTable () {
      this.$http({
        url: this.$http.adornUrl('/P2/all'),
        method: 'get',
      }).then(response => {
        this.welding = response.data
      })
      this.hanji_1(this.welding)
      this.hanji_2(this.welding)
      this.hanji_3(this.welding)
      this.hanji_4(this.welding)
      this.hanji_5(this.welding)
    },
    hanji_1 (welder) {
      this.tableData[0].hanjidianya = welder[0][0]
      this.tableData[0].hanjidianliu = welder[0][1]
      this.tableData[0].songsisudu = welder[0][2]
      this.tableData[0].residianliu = welder[0][3]
    },
    hanji_2 (welder) {
      this.tableData[1].hanjidianya = welder[1][0]
      this.tableData[1].hanjidianliu = welder[1][1]
      this.tableData[1].songsisudu = welder[1][2]
      this.tableData[1].residianliu = welder[1][3]
    },
    hanji_3 (welder) {
      this.tableData[2].hanjidianya = welder[2][0]
      this.tableData[2].hanjidianliu = welder[2][1]
      this.tableData[2].songsisudu = welder[2][2]
      this.tableData[2].residianliu = welder[2][3]
    },
    hanji_4 (welder) {
      this.tableData[3].hanjidianya = welder[3][0]
      this.tableData[3].hanjidianliu = welder[3][1]
      this.tableData[3].songsisudu = welder[3][2]
      this.tableData[3].residianliu = welder[3][3]
    },
    hanji_5 (welder) {
      this.tableData[4].hanjidianya = welder[4][0]
      this.tableData[4].hanjidianliu = welder[4][1]
      this.tableData[4].songsisudu = welder[4][2]
      this.tableData[4].residianliu = welder[4][3]
    }
  }
}
</script>

<style scoped>

</style>
